package com.corn.kafka.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : Jim Wu
 * @version 1.0
 * @function :
 * @since : 2022/7/4 15:01
 */

@RestController
public class SpringKafkaController {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @GetMapping("sendMsg")
    public void sendMsg(String msg) {
        final String topic = "test_topic";
        kafkaTemplate.send(topic, msg);
    }


}
